#include <string.h>
#include <iostream>
using std::cout;
using std::endl;

void test0(){
    char a[] = {'a','b','c'};
    char b[] = "abcd";
    char c[] = {'a','b','c','d','e','\0'};
    cout << a << endl;
    cout << b << endl;
    cout << c << endl;
    printf("a'address:%p\n",a);
    printf("b'address:%p\n",b);
    printf("c'address:%p\n",c);
    printf("c'address:%p\n",&c[0]);
}

void test1(){
    int arr[] = {1,2,3};
    char Arr1[] = "hello,world";
    char Arr2[6] = "hello";
    //C++11以后不建议这样写
    char * pa = "hello,wuhan";
    //C++中C风格字符串的推荐写法
    const char * pb = "hello,wangdao";

    cout << arr << endl;
    cout << sizeof(Arr1) << endl;
    cout << strlen(Arr1) << endl;
    //针对char型数组、指针编译器对输出流运算符有默认重载，
    //输出的不是地址，而是内容
    cout << Arr1 << endl;
    cout << static_cast<void*>(Arr1) << endl;
    cout << endl;


    cout << sizeof(pa) << endl;
    cout << strlen(pa) << endl;
    cout << pa << endl;
    cout << *pa << endl;
    cout << static_cast<void*>(pa) << endl;
}

int main(void){
    /* test0(); */
    test1();
    return 0;
}
